# 编译器设置
CC = gcc
CFLAGS = -Wall
LDFLAGS = -lrt -lpthread

# 目标定义
TARGETS = sys_cmd.out go

all: $(TARGETS)

# sys_cmd编译规则
sys_cmd.out: sys_cmd.c common.h
	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)

# go编译规则
go.out: go.c common.h
	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)

# 清理编译结果
clean:
	rm -f $(TARGETS)

# 安装到系统目录（需要root权限）
install:
	sudo cp $(TARGETS) /usr/local/bin

.PHONY: all clean install
